<!DOCTYPE html>
<html ng-app="demoApp">
	<head>
		<title>Using AngularJS Directive and Data Binding</title>
	</head>
	<body>
		<div ng-controller="SimpleController">

			<input type="text" ng-model="name" />
			<br />
			<br />
			<ul>
				<li ng-repeat="cust in customers | filter:name">
					{{cust.name}} - {{cust.city}}
				</li>
			</ul>

		</div>

		<script type="text/javascript" src="angular.min.js"></script>

		<script>
			var demoApp = angular.module('demoApp', [])

			demoApp.factory('simpleFactory', function() {
				var customers = [{
						name: 'John Smith',
						city: 'Phoenixddddd'
					},
					{
						name: 'John Doe',
						city: 'New York'
					},
					{
						name: 'Jane Doe',
						city: 'San Francisco'
					}
				];
				
				var factory = {};
				
				//this.getCustomers
				factory.getCustomers = function () {
					return custormers;
				};
				
				factory.postCustomers = function (customers) {
					return
				};
				
				return factory;
			})

			function SimpleController($scope, simpleFactory) {
				$scope.customers = []
				
				init()
				
				function init() {
					$scope.customers = simpleFactory.getCustomers()
				}
			}

			demoApp.controller('SimpleController', SimpleController)
		</script>
	</body>
</html>
